package com.lgu.iab.cleandb.springframework;

import org.aspectj.lang.ProceedingJoinPoint;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class LoggingAspect {
	private Logger logger = LoggerFactory.getLogger(getClass());
	
	public Object around(ProceedingJoinPoint pjp) {
		Object ret = null;
		try {
			Object target = pjp.getTarget();
			logger.info("## Start process! Target object is "+target.getClass().getCanonicalName());
			ret = pjp.proceed(pjp.getArgs());
			logger.info("## End process! Total " + ret + " deleted.");
		} catch (Throwable e) {
			logger.error("$$ Exception raised!\r\n"+e.toString());
			e.printStackTrace();
		}
		return ret;
	}
}
